home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7492 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: nntphost.dur.ac.uk!nntp
  2. From: M D Sergeant <M.D.Sergeant@durham.ac.uk>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: C++ Classes
  5. Date: 17 Apr 1996 14:23:01 GMT
  6. Organization: University of Durham, Durham, UK
  7. Message-ID: <4l2us5$p58@mercury.dur.ac.uk>
  8. References: <Stewart_Menday.3jrp@kumear.DIALix.oz.au>
  9. NNTP-Posting-Host: jones.dur.ac.uk
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.05 9000/710)
  14. X-URL: news:Stewart_Menday.3jrp@kumear.DIALix.oz.au
  15.  
  16. Stewart_Menday@kumear.DIALix.oz.au (Stewart Menday) wrote:
  17. >Hi ALL
  18. >     I have a question about C++ and calling functions which have been
  19. >overriden.
  20. >
  21. >If I have a class x say and it is derived from class y say and they both a
  22. >method print() say.  How do I call class y print from within class x?
  23. >
  24. >e.g.
  25. >
  26. >y.h
  27. >
  28. >class y{
  29. >public:
  30. >     void print();
  31. >     \
  32. >     /
  33. >     \
  34. >     /
  35. >
  36. >}
  37. >
  38. >x.h
  39. >
  40. >class x:public y{
  41. >public:
  42. >     void print();   
  43. >     \
  44. >     /
  45. >     \
  46. >     /
  47. >}
  48. >
  49. >x.cc
  50. >
  51. >void x::print();
  52. >{
  53. >     //some stuff for x
  54. >
  55. >     //I wish to call y.print
  56.     y::print(); // Easy huh!
  57.  
  58. >}
  59. >
  60. >Any help would be great.
  61. >
  62.  
  63. Matt.
  64.  
  65. --
  66.  m.d.sergeant@dur.ac.uk        Computer Science Project:
  67.  Matthew Sergeant         GUI for LOLITA 
  68.  University of Durham        (And wow, is it ever gooey)
  69.  
  70.